package com.iman.common.hibernate;

import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.iman.common.support.Page;
import com.iman.common.support.PageMetaData;
public interface TemplateQLService {
	Log LOGGER = LogFactory.getLog(TemplateQLService.class);
	public List findList(String queryName, Map params, int pageIndex, int pageSize) ;

	public List findSQLList(String queryName, Map params) ;
	
	public List findSQLList(String queryName, Map params, int pageIndex, int pageSize) ;

	public Object find(String queryName, Map params) ;

	public Object findSQL(String queryName, Map params) ;

	public Object executeUpdate(String queryName, Map params) ;

	public int executeSQLUpdate(String queryName, Map params) ;

	public Page findByPagedSQLQuery(String queryName, Map params, int pageIndex, int pageSize) ;

	public Page findByPagedHQLQuery(String queryName, Map params, int pageIndex, int pageSize);

	// wenzhi.zhang added 20110615 for no page class sql query
	public <T> List<T> findByPagedSQLQuery(String queryName, Map params, Class<T> entityClass) ;

	// wenzhi.zhang added 20110615 for sql page class query
	public <T> Page<T> findByPagedSQLQuery(String queryName, Map params, Class<T> entityClass, int pageIndex, int pageSize) ;

	// wenzhi.zhang added 20110615 for sql page class query result is List<map>
	public <T> Page<T> findByPagedSQLMapQuery(String queryName, Map params, int pageIndex, int pageSize) ;

	// wenzhi.zhang added 20110615 for sql page class query result is List<map>
	public <T> List<T> findBySQLMapQuery(String queryName, Map params) ;
	
	//query for namedTemplate
    public <T> List<T> findBySQLBeanQuery(String queryName, Map params, Class clazz)  ;

    //wenzhi.zhang 20110616 rs is List<bean>
    public <T> Page<T> findByPagedSQLBeanQuery(String queryName, Map params, int pageIndex, int pageSize, Class clazz)  ;

    //wenzhi.zhang added 20110620
    public List findList(String queryName, Map params) ;
    
    //带metadata的方法。namedTemplateList<Map<String,Object>>
    public PageMetaData findDataBySQLWithMetaData(String queryName, Map paramMap) ;
       
    //paging
    public PageMetaData findDataBySQLWithMetaDataPaging(String queryName, Map paramMap, int pageIndex, int pageSize) ;

    public <T> T findObjectByQuery(String queryName, Map<String, ?> params, Class clazz);
    
}